日本語
アクションフックは、アプリケーション内でマーケットプレイスとやり取りするために不可欠です。出品、オファー、購入や販売などの操作に役立ちます。
import { useCreateListingModal } from "@0xsequence/marketplace-sdk/react"; ## Into your React component: const { show: showListModal } = useCreateListingModal({ onError }); const onClickList = () => { showListModal({ collectionAddress, chainId, collectibleId, orderbookKind, }); }; return <button onClick={onClickList}>List</button>
Show child attributes
interface useCreateListingModal { onSuccess?: ({ hash, orderId }: { hash?: Hash; orderId?: string; }) => void; onError?: (error: Error) => void; }
interface ShowCreateListingModalArgs { collectionAddress: Hex; chainId: string; collectibleId: string; orderbookKind?: OrderbookKind; callbacks?: ModalCallbacks; }
import { useBuyModal } from "@0xsequence/marketplace-sdk/react"; ## Into your React component: const { show: showBuyModal } = useBuyModal({ onSuccess(hash) { console.log("Buy transaction sent with hash: ", hash); }, onError, }); const onClickBuy = () => { showBuyModal({ chainId, collectionAddress, tokenId, order, }); }; return <button onClick={onClickBuy}>Buy</button>
interface useBuyModal { onSuccess?: ({ hash, orderId }: { hash?: Hash; orderId?: string; }) => void; onError?: (error: Error) => void; }
interface ShowBuyModalArgs { chainId: string; collectionAddress: Hex; tokenId: string; order: Order; }
import { useMakeOfferModal } from "@0xsequence/marketplace-sdk/react"; ## Into your React component: const { show: showOfferModal } = useMakeOfferModal({ onError, }); const onClickOffer = () => { showOfferModal({ collectionAddress, chainId, collectibleId, orderbookKind, }); }; return <button onClick={onClickOffer}>Make Offer</button>
interface useMakeOfferModal { onSuccess?: ({ hash, orderId }: { hash?: Hash; orderId?: string; }) => void; onError?: (error: Error) => void; }
interface ShowMakeOfferModalArgs { collectionAddress: Hex; chainId: string; collectibleId: string; orderbookKind?: OrderbookKind; callbacks?: ModalCallbacks; }
import { useSellModal } from "@0xsequence/marketplace-sdk/react"; ## Into your React component: const { show: showSellModal } = useSellModal({ onError }); const onAcceptOffer = () => { showSellModal({ collectionAddress, chainId, tokenId, order, }); }; return <button onClick={onAcceptOffer}>Accept Offer</button>
interface useSellModal { onSuccess?: ({ hash, orderId }: { hash?: Hash; orderId?: string; }) => void; onError?: (error: Error) => void; }
interface ShowSellModalArgs { collectionAddress: Hex; chainId: string; tokenId: string; order: Order; callbacks?: ModalCallbacks; }
このページは役に立ちましたか?